# secondhand_market/urls.py

from django.contrib import admin
from django.urls import path, include
from django.conf import settings
from django.conf.urls.static import static

urlpatterns = [
    path('admin/', admin.site.urls),
    # 添加api前缀，与前端API调用路径保持一致
    path('api/products/', include('product.urls')),
    path('api/auth/', include('product.authentication.urls')),
    # 保留原有路径以便兼容
    path('products/', include('product.urls')),
    # 确保你添加了这行代码
    path('auth/', include('product.authentication.urls')),
]

# 添加媒体文件服务（仅在开发环境中）
if settings.DEBUG:
    urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)